package com.yorge.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("config")
@RefreshScope // 可以添加该注解实现配置自动更新
public class ConfigController {

    // springboot 使用
//    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
//    private boolean useLocalCache;

    @Value(value = "${useLocalCache:false}")
    private boolean useLocalCache;

    @RequestMapping(value = "/get")
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }
}
